import React, {Component} from 'react';
import {connect} from 'react-redux';

import PropTypes from 'prop-types';

class Header extends Component {
    static propTypes = {
        themeColor: PropTypes.string
    }

    componentDidMount() {
      console.log(this.props)
    }
    render() {
        return (
            <h1 style={{
                color: this.props.themeColor
            }}>React.js 小书</h1>
        )
    }
}

const mapStateToProps = (state) => {
    return {themeColor: state.themeColor}
}

Header = connect(mapStateToProps)(Header);

export default Header;